<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <script src="../js/jquery-3.6.0.min.js"></script>
    <style>
        html {
            height: 5000px;
        }

        /* #box::-webkit-scrollbar{
            display: none;
        } */
        #box {
            width: 200px;
            height: 200px;
            border: 1px solid transparent;
            background-color: #6ff;
            padding: 10px;
            margin: 50px;
            overflow-y: auto;
            /* display: none; */
        }

        .sub {
            height: 1000px;
            width: 100%;
            background-color: orange;
        }

        .active {
            background-color: pink !important;
            border-color: red !important;
        }

        .fixed {
            position: fixed;
            right: 5px;
            top: 5px;
        }
    </style>
</head>

<body>
    <div id="box" class="one two three">
        <div class="sub"></div>
    </div>
    <div class="fixed">
        <button class="set">set</button>
        <button class="get">get</button>
    </div>
</body>
<script>
    // scrollTop([val])   获取匹配元素相对滚动条顶部的偏移。(此方法对可见和隐藏元素均有效。)
    // scrollLeft([val])  获取匹配元素相对滚动条顶部的偏移。(此方法对可见和隐藏元素均有效。)

    // ele.addEventListener(type,callback)
    $(".set").click(function () {
        // 页面的滚动条
        // $(window).scrollTop(1000);
        // $(document).scrollTop(1000);
        // $("html").scrollTop(1000);

        $("#box").scrollTop(500);
    })

    $(".get").click(function () {
        // 页面的滚动条
        // $(window).scrollTop(1000);
        // $(document).scrollTop(1000);
        // $("html").scrollTop(1000);

        console.log($("html").scrollTop());
        console.log($("#box").scrollTop());

    })




</script>

</html>